﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.TestTools.CoveredMethodStats
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System.Collections.Generic;
using System.Reflection;
using System.Text;
using UnityEngine.Bindings;

#nullable disable
namespace UnityEngine.TestTools
{
  /// <summary>
  ///   <para>Describes the summary of the code coverage for the specified method used by TestTools.Coverage. For an example of typical usage, see TestTools.Coverage.GetStatsFor.</para>
  /// </summary>
  [NativeType(CodegenOptions.Custom, "ManagedCoveredMethodStats", Header = "Runtime/Scripting/ScriptingCoverage.bindings.h")]
  public struct CoveredMethodStats
  {
    /// <summary>
    ///   <para>The covered method.</para>
    /// </summary>
    public MethodBase method;
    /// <summary>
    ///   <para>The total number of sequence points in the method.</para>
    /// </summary>
    public int totalSequencePoints;
    /// <summary>
    ///   <para>The total number of uncovered sequence points in the method.</para>
    /// </summary>
    public int uncoveredSequencePoints;

    private string GetTypeDisplayName(System.Type t)
    {
      if (t == typeof (int))
        return "int";
      if (t == typeof (bool))
        return "bool";
      if (t == typeof (float))
        return "float";
      if (t == typeof (double))
        return "double";
      if (t == typeof (void))
        return "void";
      if (t == typeof (string))
        return "string";
      if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof (List<>))
        return "System.Collections.Generic.List<" + this.GetTypeDisplayName(t.GetGenericArguments()[0]) + ">";
      return t.IsArray && t.GetArrayRank() == 1 ? this.GetTypeDisplayName(t.GetElementType()) + "[]" : t.FullName;
    }

    public override string ToString()
    {
      if (this.method == null)
        return "<no method>";
      StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.Append(this.GetTypeDisplayName(this.method.DeclaringType));
      stringBuilder.Append(".");
      stringBuilder.Append(this.method.Name);
      stringBuilder.Append("(");
      bool flag = false;
      foreach (ParameterInfo parameter in this.method.GetParameters())
      {
        if (flag)
          stringBuilder.Append(", ");
        stringBuilder.Append(this.GetTypeDisplayName(parameter.ParameterType));
        stringBuilder.Append(" ");
        stringBuilder.Append(parameter.Name);
        flag = true;
      }
      stringBuilder.Append(")");
      return stringBuilder.ToString();
    }
  }
}
